<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
        .flip-list-move {
            transition: transform 1s;
            background-color: red;
        }
    </style>
</head>

<body>
    <div id="example-4">
        <button @click="show = !show">
            Toggle
        </button>
        <transition v-on:before-enter="beforeEnter" v-on:enter="enter" v-on:leave="leave" v-bind:css="false">
            <p v-if="show">
                Demo
            </p>
        </transition>
    </div>
    </div>
    <script src="https://cdn.bootcdn.net/ajax/libs/velocity/2.0.6/velocity.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.9/vue.js"></script>
    <script>
        // 表单操作 可以直接利用v-model指令绑定表单项，动态获取用户输入的内容
        var vm = new Vue({
            el: '#example-4',
            data: {
                show: false
            },
            methods: {
                beforeEnter: function (el) {
                    el.style.opacity = 0
                    el.style.transformOrigin = 'left'
                },
                enter: function (el, done) {
                    Velocity(el, {
                        opacity: 1,
                        fontSize: '1.4em'
                    }, {
                        duration: 300
                    })
                    Velocity(el, {
                        fontSize: '1em'
                    }, {
                        complete: done
                    })
                },
                leave: function (el, done) {
                    Velocity(el, {
                        translateX: '15px',
                        rotateZ: '50deg'
                    }, {
                        duration: 600
                    })
                    Velocity(el, {
                        rotateZ: '100deg'
                    }, {
                        loop: 2
                    })
                    Velocity(el, {
                        rotateZ: '45deg',
                        translateY: '30px',
                        translateX: '30px',
                        opacity: 0
                    }, {
                        complete: done
                    })
                }
            }
        })
    </script>
</body>

</html>